1. Technology Field
The present invention relates to a block management method for a flash memory and particularly to a block management method for averaging the use and wear of physical blocks of a flash memory, and a flash memory storage system and a flash memory controller using the same.
2. Description of Related Art
The growth of digital cameras, mobile phones, and MP3 players has been rapid in recent years. Consequently, the consumers' demand for storage media has increased tremendously. A flash memory has characteristics such as data non-volatility, low power consumption, compact size, and non-mechanical structure and thus is suitable for portable applications, particularly for portable products powered by batteries. A memory card is a storage device adopting NAND flash memory as storage medium. Memory cards have large capacity and are small and easy to carry, and therefore have been widely-used for storing important personal data. For these reasons, flash memory has become a thriving part of the electronic industries.
Generally speaking, the physical blocks of a flash memory storage system are grouped into a plurality of physical units and the physical units are further grouped into a data area and a spare area. Physical units in the data area are used for storing valid data written by write commands, and physical units in the spare area are used for substituting the physical units in the data area when the write commands are executed. More specifically, when a flash memory storage system receives a write command from a host system and is about to write a data into a physical unit in the data area, the flash memory storage system selects a physical unit from the spare area and writes both the valid old data in the physical unit in the data area and the new data into the physical unit selected from the spare area. Further, the physical unit writing with the new data is linked to the data area, and the original physical unit in the data area is erased and linked to the spare area. In order to enable the host to properly access the physical units that store data in an alternate manner, the flash memory storage system provides logical units to the host. That is, the flash memory storage system records and updates the relationship between the logical units and the physical units of the data area in the logical address-physical address mapping table to reflect the alternation of the physical units. Accordingly, the host is only required to perform writing based on the logical units and the flash memory storage system would read data from or write data into the mapped physical units according to the logical address-physical address mapping table.
However, the number of times of erasing the physical blocks is limited (for instance, the physical blocks will be damaged after ten thousand times of erasing). If one physical unit is programmed for once only, the wear of the physical blocks in the physical unit is relatively low. On the contrary, if the physical unit is repeatedly programmed and erased, the wear of the physical blocks in the physical unit is relatively high. Thus, the wear refers to the number of times for which one physical unit is programmed or erased.
When one physical block is so highly worn and becomes damaged, the system would relocate the damaged physical block in a damaged block area and stop using it, and select a new physical block as substitute from a replacement area. However, the physical blocks in the replacement area are new and haven't been used. When one of the physical blocks of the physical unit is damaged and replaced by a new physical block from the replacement area, the wear of the new physical block and other used physical blocks in the physical unit would be discrepant. In particular, when damaged physical blocks exceed a certain amount with a result that the number of physical units becomes insufficient to provide the host accessing, even if some physical blocks are not worn out yet, the flash memory storage system would still be determined as useless. In view of the above, persons skilled in the art are urged to continue developing block management methods for uniformly using all the physical blocks of the flash memory storage system, so as to effectively prolong the lifespan thereof.